﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Test Post</title>
    <link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />  
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
    <div>
        <button class="btn btn-danger" onclick="createdatas()">insert email log</button>
        <button class="btn btn-danger" onclick="getdatas()">get datas</button>
    </div>
   <script>
       function createdatas() {
           var list = [];
           list.push({ "FileName": "filename1.txt", "FileData": "fasdfsdsdfdfsdasdfasf" });
           list.push({ "FileName": "filename2.txt", "FileData": "xcvcxdfsfdsdfdfsdfxxx" });
           var jason = {
               Subject: "Subject[ID:1dfadffxxdfae23211]",
               From: "Jinyun.fan@cn.pw.com",
               To: "Testuser@pwc.com,Testuser2@pwc.com",
               Cc: "user1@cn.pwc.com,user2@pwc.com",
               //Bcc: "",
               Body: "Body_content",
               Date: "2019-07-04",
               //Attachments: list,
               APIsecretkey: "fjy_0000"
           };
           //$.post("http://localhost/GtsVentureAPI/API/AddMailLog", jason, function (rs) { console.log("post",JSON.stringify(rs)) });

           $.ajax({
               type: "POST",
               contentType: "application/json;charset=UTF-8",
               //url: "http://localhost:8081/createMailLog",
               //url:"http://localhost/GtsVentureAPI/API/AddMailLog",
               url: "http://hkappdwv016/GtsVentureAPI/API/AddMailLog",
               data: JSON.stringify(jason),
               success: function (result) {
                   console.log("ajax_post", result);
               }
           });
       }
       function getdatas() {       
           var jason = {
               BussinessID: "abcd000002",
               APIsecretkey: "fjy_0000"
           };
           //$.post("http://localhost:8081/createMailLog", jason, function (rs) { console.log("post",JSON.stringify(rs)) });

           $.ajax({
               type: "POST",
               contentType: "application/json;charset=UTF-8",
               //url: "http://localhost/GtsVentureAPI/API/GetMailLogs",
               url: "http://hkappdwv016/GtsVentureAPI/API/GetMailLogs",
               data: JSON.stringify(jason),
               success: function (result) {
                   console.log("ajax_post", result);
               }
           });
       }




       function CreateDocumentWithAttachment() {
           var url = "https://appcnhkdm450.digitalmaker.asia.pwcinternal.com/pwccnhk/gtsventure/CustomApi/CreateDocumentWithAttachment";
           var list = [];
           list.push({ "FileName": "filename1.txt", "FileData": "fasdfsdsdfdfsdasdfasf" });
           list.push({ "FileName": "filename2.txt", "FileData": "xcvcxdfsfdsdfdfsdfxxx" });
           var jason = {
               Subject: "Subject[ID:1dfadffxxdfae23211]",
               From: "Jinyun.fan@cn.pw.com",
               To: "Testuser@pwc.com,Testuser2@pwc.com",
               Cc: "user1@cn.pwc.com,user2@pwc.com",
               //Bcc: "",
               Body: "Body_content",
               Date: "2019-07-04",
               //Attachments: list,
               APIsecretkey: "fjy_0000"
           };
           //$.post(url, jason, function (rs) { console.log("post",JSON.stringify(rs)) });

           $.ajax({
               type: "POST",
               contentType: "application/json;charset=UTF-8",
               url: url,
               data: JSON.stringify(jason),
               success: function (result) {
                   console.log("ajax_post", result);
               }
           });
       }
   </script>
</body>
</html>